package com.ljx.offer;

/**
 * @author 李捷禧
 * Date: 2023/3/10
 * ClassName: fid
 */

public class C10_fidTest {

    public int fib(int n) {
           final int mod = 1000000007;
            if(n<=1) return n;
            int[] arr = new int[n+1];
            arr[0] = 0;
            arr[1] = 1;
            for (int i = 2; i <= n ; i++) {
                arr[i]=(arr[i-1]+arr[i-2]) % mod;
            }
            return arr[n];
    }

    public static void main(String[] args) {
        System.out.println(new C10_fidTest().fib(5));
    }
}
